﻿using UnityEngine;
using System.Collections;

public class CloudNine : MonoBehaviour 
{
	 private GameObject clouds;
	private GameObject cloudRain;
     private float mTimer = 0;
     public float acrossTheScreenInSecs;
		// Use this for initialization
	void Start () 
	{
		clouds = transform.GetChild(0).gameObject;
		cloudRain = clouds.transform.GetChild(0).gameObject;
        cloudRain.particleSystem.startDelay = 60;
        //set a timer for cloud rain
	}
	
	// Update is called once per frame
	void Update () 
	{
        mTimer = Time.time;
	
		if(mTimer > acrossTheScreenInSecs)
		{
            clouds.particleSystem.Play();
            

            //clouds.particleSystem.startDelay =  acrossTheScreenInSecs ;

			if(mTimer> acrossTheScreenInSecs +60){
                cloudRain.particleSystem.Play();

			}
			if(mTimer> acrossTheScreenInSecs + 200){
				cloudRain.particleSystem.Stop();
				
			}
		}
		if(mTimer > acrossTheScreenInSecs + 400)
		{
            clouds.particleSystem.Play();
		}
	}
}
